<template>
  <div>
    <a-form style="max-width: 800px; margin: 40px auto 0;">
      <result title="发券成功" :is-success="true" v-if="res.success && !res.result.asyncFlag">
        <div class="information">
          <a-row>
            <a-col :sm="8" :xs="24">会员数:</a-col>
            <a-col :sm="16" :xs="24"><span class="red">{{res.result.successMemberCnt}}</span></a-col>
          </a-row>
          <a-row>
            <a-col :sm="8" :xs="24">发券张数:</a-col>
            <a-col :sm="16" :xs="24"><span class="red">{{res.result.successCouponCnt}}</span></a-col>
          </a-row>
        </div>
        <div slot="action">
          <a-button type="primary" @click="handelToView">查看发券记录</a-button>
          <a-button type="default" @click="finish" style="margin-left:5px;">关闭</a-button>
        </div>
      </result>
      <result title="正在发券中" :is-success="true" v-if="res.success && res.result.asyncFlag">
        <div class="information">
          <a-row>
            <a-col :sm="24" :xs="24" style="text-align:center">结果到<span class="red">会员发券列表</span>查看</a-col>
          </a-row>
        </div>
        <div slot="action">
          <a-button type="primary" @click="handelToView">查看发券结果</a-button>
          <a-button type="default" @click="finish" style="margin-left:5px;">关闭</a-button>
        </div>
      </result>
    </a-form>
  </div>
</template>

<script>
import Result from '../../../result/Result'

export default {
  name: "Step3",
  inject:['closeCurrent'],
  components: {
    Result
  },
  data() {
    return {
      loading: false,
      res: {},
    }
  },
  methods: {
    showResult(res){
      console.log('---step3 showResult---', res)
      this.res = res
    },
    finish() {
      this.closeCurrent()
    },
    handelToView(){
      this.$router.push({ path: '/marketing/distCouponSenceList'})
    }
  }
}
</script>
<style lang="less" scoped>
.red {
  color: red
}

.information {
  line-height: 22px;

  .ant-row:not(:last-child) {
    margin-bottom: 24px;
  }
}
</style>